{
GdkEvent *event;
+ g_print ("%s %lf %lf\n", G_STRFUNC, x, y);
+
event = gdk_event_new (type);
event->button.x = x;
event->button.y = y;
}
}
-/* TODO: Remove once we have proper transient window support. */
-typedef struct
-{
- GdkWindow *except;
- gdouble x;
- gdouble y;
- guint32 time;
-} LeaveInfo;
-
-/* TODO: Remove once we have proper transient window support. */
-/*
- * leave_windows_except:
- *
- * Generate a leave event for every window except the one the cursor is in.
- */
-static void
-leave_windows_except (GdkWindow *window,
- gpointer user_data)
-{
- LeaveInfo info = *((LeaveInfo *) user_data);
-
- info.x -= window->x;
- info.y -= window->y;
-
- _gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
-
- if (window != info.except)
- {
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- gboolean cursor_inside;
- guint button_state;
-
- _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside, &button_state);
-
- if (cursor_inside)
- generate_crossing_event (window, GDK_LEAVE_NOTIFY, info.x, info.y, info.time);
-
- _gdk_mir_window_impl_set_cursor_state (impl, info.x, info.y, FALSE, button_state);
- }
-}
-
static guint
mir_pointer_event_get_button_state (const MirPointerEvent *event)
{
modifier_state = get_modifier_state (mir_pointer_event_modifiers (pointer_event), mir_pointer_event_get_button_state (pointer_event));
event_time = NANO_TO_MILLI (mir_input_event_get_event_time (event));
- /* TODO: Remove once we have proper transient window support. */
- if (mir_pointer_event_action (pointer_event) == mir_pointer_action_leave)
- {
- LeaveInfo info;
-
- info.x = x;
- info.y = y;
- info.time = event_time;
- info.except = window;
-
- /* Leave all transient children from leaf to root, except the root since we do it later. */
- _gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
- }
- else
- {
- LeaveInfo info;
-
- info.x = x;
- info.y = y;
- info.time = event_time;
- info.except = _gdk_mir_window_get_visible_transient_child (window, x, y, &x, &y);
-
- /* Leave all transient children from leaf to root, except the pointer window since we enter it. */
- _gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
-
- window = info.except;
-
- if (window)
- {
- /* Enter the pointer window. */
- gboolean cursor_inside_pointer_window;
-
- impl = GDK_MIR_WINDOW_IMPL (window->impl);
- _gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside_pointer_window, NULL);
-
- if (!cursor_inside_pointer_window)
- {
- generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
- _gdk_mir_window_impl_set_cursor_state (impl, x, y, TRUE, mir_pointer_event_get_button_state (pointer_event));
- }
- }
- }
-
if (window)
{
gdouble new_x;
{
case mir_pointer_action_button_up:
case mir_pointer_action_button_down:
+ g_print ("%s button up/down\n", G_STRFUNC);
+
event_type = mir_pointer_event_action (pointer_event) == mir_pointer_action_button_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
changed_button_state = button_state ^ mir_pointer_event_get_button_state (pointer_event);
if (changed_button_state == 0 || (changed_button_state & mir_pointer_button_primary) != 0)
gint transient_x;
gint transient_y;
- /* Child windows (e.g. tooltips) */
- GList *transient_children;
-
/* Desired surface attributes */
MirSurfaceType surface_type;
MirSurfaceState surface_state;
return surface;
}
-/* TODO: Remove once we have proper transient window support. */
-static gboolean
-should_render_in_parent (GdkWindow *window)
-{
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
- return impl->transient_for && gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL;
-}
-
static void
ensure_surface_full (GdkWindow *window,
MirBufferUsage buffer_usage)
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
GdkMirWindowReference *window_ref;
- if (impl->surface || should_render_in_parent (window))
+ if (impl->surface)
return;
/* no destroy notify -- we must leak for now
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- /* Transient windows draw onto parent instead */
- if (should_render_in_parent (window))
- {
- redraw_transient (window);
- return;
- }
-
- /* Composite transient windows over this one */
- if (impl->transient_children)
- {
- cairo_surface_t *surface;
- cairo_t *c;
- GList *link;
-
- surface = gdk_mir_window_impl_ref_cairo_surface (window);
- c = cairo_create (surface);
-
- for (link = impl->transient_children; link; link = link->next)
- {
- GdkWindow *child_window = link->data;
- GdkMirWindowImpl *child_impl = GDK_MIR_WINDOW_IMPL (child_window->impl);
-
- /* Skip children not yet drawn to */
- if (!child_impl->cairo_surface)
- continue;
-
- cairo_set_source_surface (c, child_impl->cairo_surface, child_window->x, child_window->y);
- cairo_rectangle (c, child_window->x, child_window->y, child_window->width, child_window->height);
- cairo_fill (c);
- }
-
- cairo_destroy (c);
- cairo_surface_destroy (surface);
- }
-
/* Send the completed buffer to Mir */
mir_surface_swap_buffers_sync (impl->surface);
}
/* Transient windows get rendered into a buffer and copied onto their parent */
- if (should_render_in_parent (window) || window->gl_paint_context)
+ if (window->gl_paint_context)
{
cairo_surface = cairo_image_surface_create (pixel_format, window->width, window->height);
}
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
GList *link;
- for (link = impl->transient_children; link; link = link->next)
- {
- GdkWindow *window = link->data;
- gdk_window_destroy (window);
- }
-
if (impl->background)
cairo_pattern_destroy (impl->background);
if (impl->surface)
mir_surface_release_sync (impl->surface);
if (impl->cairo_surface)
cairo_surface_destroy (impl->cairo_surface);
- g_list_free (impl->transient_children);
G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
}
impl->cursor_inside = FALSE;
impl->visible = FALSE;
ensure_no_surface (window);
-
- if (should_render_in_parent (window))
- redraw_transient (window);
}
static void
impl->cursor_inside = FALSE;
impl->visible = FALSE;
ensure_no_surface (window);
-
- if (should_render_in_parent (window))
- redraw_transient (window);
}
static void
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
gboolean recreate_surface = FALSE;
- /* Redraw parent where we moved from */
- if (should_render_in_parent (window))
- redraw_transient (window);
-
/* Transient windows can move wherever they want */
if (with_move)
{
- if (should_render_in_parent (window))
- {
- window->x = x;
- window->y = y;
- }
- else if (x != impl->transient_x || y != impl->transient_y)
+ if (x != impl->transient_x || y != impl->transient_y)
{
impl->transient_x = x;
impl->transient_y = y;
ensure_no_surface (window);
ensure_surface (window);
}
-
- /* Redraw parent where we moved to */
- if (should_render_in_parent (window))
- redraw_transient (window);
}
static void
impl->visible = FALSE;
ensure_no_surface (window);
-
- if (should_render_in_parent (window))
- {
- /* Redraw parent */
- redraw_transient (window);
-
- /* Remove from transient list */
- GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (impl->transient_for->impl);
- parent_impl->transient_children = g_list_remove (parent_impl->transient_children, window);
- }
}
static void
/* Link this window to the parent */
impl->transient_for = parent;
- if (should_render_in_parent (window))
- {
- GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
- parent_impl->transient_children = g_list_append (parent_impl->transient_children, window);
-
- /* Move to where the client requested */
- window->x = impl->transient_x;
- window->y = impl->transient_y;
-
- /* Remove surface if we had made one before this was set */
- ensure_no_surface (window);
-
- /* Redraw onto parent */
- redraw_transient (window);
- }
-}
-
-/* TODO: Remove once we have proper transient window support. */
-GdkWindow *
-_gdk_mir_window_get_visible_transient_child (GdkWindow *window,
- gdouble x,
- gdouble y,
- gdouble *out_x,
- gdouble *out_y)
-{
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- GdkWindow *child = NULL;
- GList *i;
-
- x -= window->x;
- y -= window->y;
-
- if (x < 0 || x >= window->width || y < 0 || y >= window->height)
- return NULL;
-
- for (i = impl->transient_children; i && !child; i = i->next)
- {
- if (GDK_MIR_WINDOW_IMPL (GDK_WINDOW (i->data)->impl)->visible)
- child = _gdk_mir_window_get_visible_transient_child (i->data, x, y, out_x, out_y);
- }
-
- if (child)
- return child;
-
- *out_x = x;
- *out_y = y;
-
- return window;
-}
-
-/* TODO: Remove once we have proper transient window support. */
-void
-_gdk_mir_window_transient_children_foreach (GdkWindow *window,
- void (*func) (GdkWindow *, gpointer),
- gpointer user_data)
-{
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
- g_list_foreach (impl->transient_children, (GFunc) func, user_data);
}
static void